<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
</head>
<body>
    <script>
        var pro = new Promise(function(resolve,reject) {
            var flag = false;
            if(flag) {
                resolve('我是正确时的回调数据');
            }else {
                reject('我是错误时的回调数据')
            }
        });

        pro.then(function(res){
            console.log(res);
            
        },function(res){
            console.log(res);
            
        })
    </script>
</body>
</html>